package com.mytest.example.gobrs.task.chain3;

import com.gobrs.async.TaskSupport;
import com.gobrs.async.anno.Task;
import com.gobrs.async.task.AsyncTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Task(failSubExec = true)
@Component
public class Chain3TaskB extends AsyncTask<Chain3Param2, String> {
    @Override
    public void prepare(Chain3Param2 o) {

    }

    @Override
    public String task(Chain3Param2 o, TaskSupport taskSupport) {
        log.info("Chain3TaskA param={}", o.getTicket());
        return "Chain3TaskB";
    }

    @Override
    public boolean nessary(Chain3Param2 o, TaskSupport taskSupport) {
        return true;
    }

    @Override
    public void onSuccess(TaskSupport taskSupport) {
        log.info("Chain3TaskB 执行完成");

    }

    @Override
    public void onFail(TaskSupport taskSupport) {
        log.error("Chain3TaskB 执行失败");
    }
}
